public class exaple数组和 { public static void main(String[] args){
    int[] arr3={1, 2, 3};
    int sum =0;
    for (int i = 0;i<arr3.length;i++){
        sum += arr3[i];
    }
    System.out.println("数组所有元素的和:" + sum);
    int max =arr3[0];
    for (int i = 1; i<arr3.length;i++){
        if (arr3[i]>max){
            max = arr3[i];

        }
    }
    System.out.println("数组最大值："+max);
}
}
